﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcVehicleInsurance.Models;

namespace MvcVehicleInsurance.Controllers
{
    public class InsuranceTypeController : Controller
    {

        private DataClassesVehicleDataContext data = new DataClassesVehicleDataContext();
        
        
        //
        // GET: /InsuranceType/

        public ActionResult Index()
        {
            List<MvcVehicleInsurance.Models.CustomerPolicyRecord> listcpr = (from cpr in data.CustomerPolicyRecords select cpr).ToList();
            if (listcpr.Count > 0)
            {
                return View(listcpr);
            }

            return View();
        }



        //
        // GET: /InsuranceType/Details/5

        public ActionResult Details(int id)
        {
            CustomerPolicyRecord details_cpr = data.CustomerPolicyRecords.Where(dt => dt.policyNumber == id.ToString()).First();
            if (ModelState.IsValid)
            {
                return View(details_cpr);
            }

            return View();
        }

     
    }
}
